package by.ostrovsky.webhousingsystem.dao.implementation;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;

import by.ostrovsky.webhousingsystem.dao.implementation.idao.IWizardDAO;

public class MySQLWizardDAO<T> implements IWizardDAO<T>{
	private Session session = null;
	
	public MySQLWizardDAO(WizardTransactor transactor){
		this.session = transactor.getSession();
	}

	@Override
	public void delete(T object) throws HibernateException{
		session.delete(object);
	}

	@Override
	public void update(T object) throws HibernateException{
		session.update(object);
	}

	@Override
	public void update(List<T> object) throws HibernateException{
		for(T obj : object){
			session.update(obj);
		}
	}

	@Override
	public void save(T object) throws HibernateException{
		session.save(object);
	}
}
